<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title><?php echo C("SITE_NAME");?>管理后台</title>
<link rel="shortcut icon" href=" /favicon.ico" />
<link rel="stylesheet" href="/Static/admin/css/component-min.css">
<link rel="stylesheet" href="/Static/admin/css/home.2015.05.22-09.32.css">
<link rel="stylesheet" href="/Static/admin/icon/iconfont.css">
<!--弹窗-->
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script src="/Static/admin/js/layer-2.x/layer.js?v=1.9.0"></script>
<script src="/Static/admin/js/common.js"></script>
<script>
	var UPYUN_DOMAIN = '<?php echo C("UPYUN_DOMAIN");?>';
</script>
</head>
<body class="cp-bodybox">
<!--[if lt IE 9]>
<div class="alert alert-danger disable-del txtCenter" id="tipLowIEVer">
    <h4>系统检测到您使用的浏览器版本过低，为达到更好的体验效果请升级您的浏览器，我们为您推荐：</h4>
    <p>
        <a href="http://www.firefox.com.cn/download/" target="_blank">Firefox浏览器</a>
        <a href="http://www.maxthon.cn/" target="_blank">遨游浏览器</a>
        <a href="http://se.360.cn/" target="_blank">360浏览器</a>
    </p>
</div>
<![endif]-->
<style>
.header-nav-list a {
  display: block;
  padding: 0 10px;
  min-width: 70px;
  line-height: 53px;
  font-size: 14px;
  text-align: center;
  font-weight: 700;
}
</style>

<div class="header">
    <div class="inner clearfix">
        <div class="fl">
            <a href="/" class="header-logo">
                <img
                    src="<?php echo C('UPYUN_DOMAIN'); echo C('SITE_TOPLOGO2');?>"
                    onerror="javascript:this.src='/Static/admin/images/error.png';"
                    ></a>
        </div>
        <!-- end logo -->

        <div class="header-nav fl">
            <ul class="header-nav-list clearfix">
                <!--<li class="fl <?php echo ($controller == 'index')?'active':'';?>"><a href="/admin">首页</a></li>-->
                <?php foreach($MENU as $k=>$v){?>
                <li class="fl <?php echo ($controller == $v['controller'])?'active':'';?>">
                    <a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
                </li>
                <?php } ?>
            </ul>
        </div>
        <!-- end header-nav -->

        <div class="fr">
            <ul class="header-ctrl clearfix">
                <li class="header-ctrl-item fl"><a href="/admin/login/logout">退出</a></li>
            </ul>
        </div>

        <span class="account_inbox_switch fr"></span>
        <span class="header-welcome fr">
            <a href="javasecript:;" class="tips" data-trigger="hover" data-placement="top"><?php echo $admininfo['username'];?></a>
        </span>

    </div>
</div>
<!-- end header -->
	<div class="container">
		<div class="inner clearfix">
	<div class="content-left fl">
    <?php foreach($SUBMENU as $subkey=>$sub){ ?>
    <dl class="left-menu shop_8">
        <dt>
            <i class="icon-menu home"></i> <span id="shop_0" data-id="0"><?=$sub['title']?></span>
        </dt>
        <?php foreach($sub['menu'] as $menu){ ?>
        <dd class="<?php echo ($action == $menu["action"])?'active':'';?>">
            <a href="<?=$menu['url']?>"><?=$menu['title']?></a>
        </dd>
        <?php } ?>
    </dl>
    <?php } ?>
</div>
<div class="content-right fl">
    <h1 class="content-right-title">申请列表</h1>

    <div class="tablesWrap">
        <div class="tabs clearfix mgt10">
            <a href="/admin/member/apply" class="<?php echo (!isset($_GET['status']))?'active':'';?> tabs_a fl">全部</a>
            <a href="/admin/member/apply?status=0" class="<?php echo (isset($_GET['status']))&&$_GET['status']==0?'active':'';?> tabs_a fl">待审核</a>
            <a href="/admin/member/apply?status=1" class="<?php echo ($_GET['status']==1)?'active':'';?> tabs_a fl">已通过</a>
            <a href="/admin/member/apply?status=2" class="<?php echo ($_GET['status']==2)?'active':'';?> tabs_a fl">已拒绝</a>
        </div>
        <div>
    </div>


    <!-- end tables-searchbox -->
    <table class="wxtables" style="margin-top:10px;">
        <colgroup>
            <col width="6%">
            <col width="6%">
            <col width="8%">
            <col width="6%">
            <col width="6%">
            <col width="6%">
        </colgroup>
        <thead>
            <tr>
                <td>用户信息</td>
                <td>类型</td>
                <td>地区信息</td>
                <td>申请时间</td>
                <td>状态</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>

            <?php if(is_array($datalist)): foreach($datalist as $key=>$vo): ?><tr>
                    <td>
                        用户ID:<?php echo ($vo['member']['uid']); ?><br>
                        用户姓名:<?php echo ($vo['member']['realname']); ?><br>
                    </td>
                    <td>
                        <?php if($vo['type']==1) { ?>
                            地区代理
                        <?php } ?>
                        <?php if($vo['type']==2) { ?>
                            加盟商
                        <?php } ?>
                    </td>
                    <td>
                        <?php echo ($vo['area']['all_name']); ?><br>
                    </td>
                    <td>
                        <?php echo ($vo['create_time']); ?>
                    </td>
                    <td>
                        <?php if($vo['status']==0) { ?>
                            待审核
                        <?php } ?>
                        <?php if($vo['status']==1) { ?>
                            审核通过<br>
                            <?php echo ($vo['shenhe_time']); ?><br>
                            管理员:<?php echo ($vo['shenhe_username']); ?><br>
                        <?php } ?>
                        <?php if($vo['status']==2) { ?>
                            已拒绝<br>
                            原因:<?php echo ($vo['note']); ?><br>
                        <?php } ?>
                    </td>
                    <td>
                        <?php if($vo['status']==0) { ?>
                            <a onclick="shenhe(<?php echo ($vo['id']); ?>,1)" class="btn btn-success btn-small" >通过</a>
                            <a onclick="shenhe(<?php echo ($vo['id']); ?>,2)"  class="btn btn-danger btn-small" >拒绝</a>
                        <?php } ?>
                    </td>
                </tr><?php endforeach; endif; ?>
        </tbody>
    </table>

    <div class="tables-btmctrl clearfix">
        <div class="mgt10">
            <div class="paginate">
                <?php echo ($page); ?>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.bootcss.com/layer/3.1.0/layer.js"></script>
<script>
    function shenhe (id,status) {
        if(status==2) {
            layer.prompt({title: '请输入拒绝原因', formType: 2}, function(text, index){
                $.ajax({
                    url:'/admin/member/shenheApply',
                    data: {
                        status: status,
                        id: id,
                        note: text
                    },
                    type:'post'
                }).then(function(res){
                    layer.close(index);
                    if(res.ret==1) {
                        layer.msg(res.msg, { icon: 2 },function(){
                            location.reload();
                        });
                    }else{
                        layer.msg(res.msg, { icon: 1 },function(){
                            location.reload();
                        });
                    }
                })
            });
        }else if(status==1){
            layer.confirm('确定审核通过吗?', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                $.ajax({
                    url:'/admin/member/shenheApply',
                    data: {
                        status: status,
                        id: id
                    },
                    type:'post'
                }).then(function(res){
                    if(res.ret==1) {
                        layer.msg(res.msg, { icon: 2 },function(){
                            location.reload();
                        });
                    }else{
                        layer.msg(res.msg, { icon: 1 },function(){
                            location.reload();
                        });
                    }
                })
                
            }, function () {
               
            });
        }
        
    }
</script>
		</div>
	</div>
<!--gonggao-->
<div class="footer">&copy; <?php echo date("Y");?> <?php echo C("SITE_NAME");?> , Inc. All rights reserved.</div>
<a href="#" id="j-gotop" class="gotop" title="回到顶部" style="right:45px; display: inline;"></a>
<script type="text/javascript">
$(function(){
    var height1=$(".content-right").height();
    var height2=$(".content-left").height();
    if(parseInt(height1) < parseInt(height2)){
        $(".content-right").css({'min-height': height2});
    }
    $(window).scroll(function() {
		$(this).scrollTop() >= 150 ? $("#j-gotop").fadeIn(300) : $("#j-gotop").fadeOut(300)
	});
});
</script>
</body>
</html>